package com.sky.controller;
import com.sky.bean.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachePut;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RequestMapping("localhost:8080/")
@RestController
public class CacheController {


    @Autowired
    private CacheManager cacheManager;

    @CachePut(cacheNames = "user",key = "#result.id")
    @RequestMapping("/add")
    public User addUser(){
        System.out.println("damn!@!!");
        return new User(1,"damn",32);
    }

}
